Adds a fast basket endpoint and functions - #21
Conversation
…d of fetching all works to improve performance
…package prices This commit adds a new management command `pregenerate_prices.py` that pregenerates package prices. The command retrieves a full list of countries that have currencies and calculates the minimum and maximum prices for each package and country combination. The results are stored in a dictionary `package_list` and printed to the console. This command will be useful for generating price data for packages in advance.
… readability and maintainability
…iew to filter out unwanted data
…ew to improve code readability and maintainability
…d and causing confusion
…ew to improve code readability and maintainability
…rove readability and maintain consistency
…play multiple contributors and their institutions
…rying works with related contributions
…r better performance
…ormance and reduce database queries in all_books view
…or to improve performance
…int to 'summary_meta_package' instead of 'summary_package_initiative' for consistency and clarity
…m the dropdown menu 🔧 fix(views.py): remove commented out code that was no longer needed
…rove performance and reduce database queries in ThothWorkManager 🔀 refactor(views.py): remove unnecessary filter condition in all_books view
…l to improve accuracy and readability
…obile view to improve readability and user experience
…o improve readability and aesthetics 🎨 style(style.css): update font family and size for various elements to improve consistency and aesthetics ✨ feat(index.html): add pill buttons to build subscription, search catalogue, and apply for membership sections for better user experience
…t key in col 4 body section
Added updates to docs
Add a new option to filter initiatives from the selectable list.
Model translations wip
| model_name='bandingtypecurrencyentry', | ||
| index=models.Index(fields=['package', 'banding_type_entry'], name='btce_pkg_bte_idx'), | ||
| ), | ||
| migrations.AddIndex( |
There was a problem hiding this comment.
Unsure how helpful this index will be, as the bandingtypeentry is probably shared by many rows
| else: | ||
| self.helper.layout.append( | ||
| Layout( | ||
| HTML( |
There was a problem hiding this comment.
Somewhat curious offloading the HTML generation into this routine, rather than using a template?
| return prices | ||
|
|
||
| @functools.cached_property | ||
| def fast_price_bandings(self) -> dict: |
There was a problem hiding this comment.
This looks OK, but I really would like it to have a debug/logging mode where it writes output about what it is doing to the price debugger. Could just add an optional parameter to the function debug=False that when true then returns a tuple of (prices, debug_string). This way we could easily hook it up to the debugger? I am just worried that, although it all looks fine at this point, we might hit an edge case with OBC where we can't work out what it's doing and need to debug the logic.
There was a problem hiding this comment.
Hmm. This might be the wrong place for this comment. I can see that other functions still have the "explain" bool signature, below, so perhaps the debugger is still in tact
| def _compare(self, package): | ||
| original = package.price_bandings | ||
|
|
||
| if "fast_price_bandings" in package.__dict__: |
There was a problem hiding this comment.
I think this code is forcing a cached property to reload, but it's hard to understand. It looks like the code deletes an instance attribute but then accesses it immediately...
No description provided.